﻿'========================================================================
'功能:員工資料商業邏輯物件
'作者:andy
'日期: 2011/1/31
'========================================================================

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Text
Imports System.Data
Namespace OAMS.BBL
    Public Class UsersBBL

        Public Sub UpdateUIDefine(ByVal UID As String, ByVal UICulture As String, ByVal Theme As String, ByVal MenuCollapsible As Boolean, ByVal WinTargetBlank As Boolean, ByVal dbName As String)
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            db1.UpdateUIDefine(UID, UICulture, Theme, MenuCollapsible, WinTargetBlank)

        End Sub

        Public Sub SetLanguage(ByVal UID As String, ByVal UICulture As String, ByVal dbName As String)
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            db1.SetLanguage(UID, UICulture)
        End Sub

        Public Function GetLanguage(ByVal UID As String, ByVal dbName As String) As String
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetLanguage(UID)
        End Function


        Public Function GetTheme(ByVal UID As String, ByVal dbName As String) As String

            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetTheme(UID)
        End Function

        Public Function GetMenuCollapsible(ByVal UID As String, ByVal dbName As String) As Boolean

            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetMenuCollapsible(UID)
        End Function


        Public Function GetWinTargetBlank(ByVal UID As String, ByVal dbName As String) As Boolean
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetWinTargetBlank(UID)
        End Function


        ''' <summary>
        ''' 檢查某一個工號是否在資料庫中
        ''' </summary>
        ''' <param name="UID"></param>
        ''' <returns>檢查某一個工號是否在資料庫中</returns>
        ''' <remarks>檢查某一個工號是否在資料庫中</remarks>
        Public Function UserIsExist(ByVal UID As String, ByVal dbName As String) As Boolean
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.UserIsExist(UID)
        End Function

        ''' <summary>
        ''' 查詢員工基本資料傳入工號或姓名都可以空白代表全部
        ''' </summary>
        ''' <param name="UIDOrUserName"></param>
        ''' <returns>查詢員工基本資料傳入工號或姓名都可以空白代表全部</returns>
        ''' <remarks>查詢員工基本資料傳入工號或姓名都可以空白代表全部</remarks>
        Public Function GetUsers(ByVal UIDOrUserName As String, ByVal dbName As String) As DataTable
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetUsers(UIDOrUserName)
        End Function

        ''' <summary>
        ''' 取得使用者姓名
        ''' </summary>
        ''' <param name="UID"></param>
        ''' <returns>取得使用者姓名</returns>
        ''' <remarks>取得使用者姓名</remarks>
        Public Function GetUserName(ByVal UID As String, ByVal dbName As String) As String
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetUserName(UID)
        End Function

        Public Function GetUsersLogin(ByVal LoginID As String, ByVal dbName As String) As DataTable
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetUsersLogin(LoginID)
        End Function

        Public Function GetEmpData(ByVal emp_no As String, ByVal dbName As String) As DataTable
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetEmpData(emp_no)
        End Function

        Public Function GetUserCategory(ByVal dbName As String) As DataTable
            Dim db1 As OAMS.DAO.UsersDAO = New OAMS.DAO.UsersDAO(dbName)
            Return db1.GetUserCategory()
        End Function

    End Class
End Namespace

